% setup problem 

N = 128;
h = 1/N;
x = [0:h:1]';

u = exp(x).*sin(pi*x);
f = (pi^2*sin(pi*x)-2*pi*cos(pi*x)-sin(pi*x)).*exp(x);

A = sparse(diag(2*ones(N-1,1))+diag(-ones(N-2,1),1) ....
          +diag(-ones(N-2,1),-1));

A = (1/(h*h))*A;
spy(A)
u_h = A\f(2:N);
u_h = [0; u_h; 0];

v_in = 0*u;
nu_down = 100;
nu_up   = 500;

v_out = Vcycle_1d(v_in,f,nu_down,nu_up,u_h);

%norm(v_out)
%norm(u_h)


